package com.example.demo;

import com.example.demo.model.Readlist;
import com.example.demo.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: Administrator
 * \* Date: 2022/7/10
 * \* Time: 14:36
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */

@Controller
public class UserController {

    @Value("${server.port}")
    private String port;

    @Value("${mystring}")
    private String mystring;
    @Value("${mystring2}")
    private String mystring2;
    @Value("${mystring3}")
    private String mystring3;

    @Autowired
    private Student student2;

    @Resource
    private Readlist readlist;

    @ResponseBody //返回一个非静态页面的数据
    @RequestMapping("/sayhi")//设置路由地址
    public  String sayHi(){
//        System.out.println("mystring:" + mystring);
//        System.out.println("mystring:" + mystring2);
//        System.out.println("mystring:" + mystring3);
//        return "Hello World! |port:" + port ;
        return "readList:" + readlist.getName();
    }
}
